package org.elanfox.intellicommunity.common.utils;

import java.math.BigDecimal;

/**
 * @author allan
 * @date 2019-10-18
 */
public class MathUtils {
    /**
     * a>b
     *
     * @param a
     * @param b
     * @return
     */
    public static boolean greater(BigDecimal a, BigDecimal b) {
        return a.compareTo(b) > 0;
    }

    /**
     * a<b
     *
     * @param a
     * @param b
     * @return
     */
    public static boolean less(BigDecimal a, BigDecimal b) {
        return a.compareTo(b) < 0;
    }

    /**
     * a==b
     *
     * @param a
     * @param b
     * @return
     */
    public static boolean equalTo(BigDecimal a, BigDecimal b) {
        return a.compareTo(b) == 0;
    }

    /**
     * a>=b
     *
     * @param a
     * @param b
     * @return
     */
    public static boolean greaterAndEqual(BigDecimal a, BigDecimal b) {
        return a.compareTo(b) > -1;
    }

    /**
     * a<=b
     *
     * @param a
     * @param b
     * @return
     */
    public static boolean lessAndEqual(BigDecimal a, BigDecimal b) {
        return a.compareTo(b) < 1;
    }
}
